package com.example.websocket.pattern.creational.factory.abstractFactoryPattern;

import com.example.websocket.pattern.creational.factory.abstractFactoryPattern.line.color.Color;
import com.example.websocket.pattern.creational.factory.abstractFactoryPattern.line.shape.Circle;
import com.example.websocket.pattern.creational.factory.abstractFactoryPattern.line.shape.Rectangle;
import com.example.websocket.pattern.creational.factory.abstractFactoryPattern.line.shape.Shape;
import com.example.websocket.pattern.creational.factory.abstractFactoryPattern.line.shape.Square;

// 形状工厂
public class ShapeFactory extends AbstractFactory {

    @Override
    public Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        } else if (shapeType.contains("CIRCLE")) {
            return new Circle();
        } else if (shapeType.contains("SQUARE")) {
            return new Square();
        } else if (shapeType.contains("RECTANGLE")) {
            return new Rectangle();
        }
        return null;
    }

    @Override
    public Color getColor(String colorType) {
        return null;
    }
}
